import book.BookList;
import user.Administrator;
import user.NormalUser;
import user.User;

import java.util.Scanner;

public class Test {

    public static User login() {
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入姓名：");
        String name = scan.nextLine();
        System.out.println("请输入身份：   1管理员   0普通用户");
        int num = scan.nextInt();
        if(num == 1)
            return new Administrator(name);
        else
            return new NormalUser(name);

    }

    public static void main(String[] args) {
        BookList bookList = new BookList();  //创建图书
        User user = login();
        while (true){
            Scanner scan=new Scanner(System.in);
            int choice=user.menu();
            user.doOperation(choice,bookList);
        }
    }
}
